package com.atlige.gzmall.auth.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Jeremy Li
 * @data 2021/3/31 - 16:38
 */
@Configuration

public class GzMallWebConfig implements WebMvcConfigurer {
    /**
     * @GetMapping({"/", "/login.html"})
     *     public String login(){
     *         System.out.println("正在登录...");
     *         return "login";
     *     }
     *
     *  发送一个请求直接跳转到一个页面
     *  SpringMVC viewController ：将请求和页面映射过来
     *
     * @param registry
     */
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/login.html").setViewName("login");
        registry.addViewController("/reg.html").setViewName("reg");
    }
}
